package com.atguigu.spring6.tx.service;

import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

public interface BookService {
    //@Transactional(rollbackFor = Exception.class,readOnly = true)
    //@Transactional(noRollbackFor = ArithmeticException.class,timeout = 3)
    @Transactional(noRollbackFor = ArithmeticException.class,timeout = 3)
    void buyBook4(Integer bookId, Integer userId);

    //@Transactional(rollbackFor = Exception.class,readOnly = true)
    //@Transactional(noRollbackFor = ArithmeticException.class,timeout = 3)
    @Transactional(noRollbackFor = ArithmeticException.class,timeout = 3)
    void buyBook1(Integer bookId, Integer userId);

    @Transactional(noRollbackFor = ArithmeticException.class)
    void buyBook2(Integer bookId, Integer userId);

    @Transactional(isolation = Isolation.DEFAULT)
    void buyBook3(Integer bookId, Integer userId);

    void buyBook(Integer bookId, Integer userId) throws InterruptedException;
}
